package com.chenchao.method;

import java.util.Scanner;

/**
 * @encoding : UTF-8
 * @Time : 2020/11/7 11:16
 * @Author : Chen Chao
 * @File : javaSE.com.chenchao.javamethod.Test3.java
 * @Software : IntelliJ IDEA
 * @since : 1.8
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要运算的运算符");
        String str=scanner.nextLine();
        System.out.println("请输入两个数");
        Double num1=scanner.nextDouble();
        Double num2=scanner.nextDouble();
        switch (str){
            case "+":
                System.out.println(add(num1, num2));
                break;
            case "-":
                System.out.println(sub(num1, num2));
                break;
            case "*":
                System.out.println(mul(num1, num2));
                break;
            case "/":
                System.out.println(div(num1, num2));
                break;
        }
        scanner.close();
    }
    public static double add(double num1,double num2){
        return num1+num2;
    }
    public static double sub(double num1,double num2){
        return num1-num2;
    }
    public static double mul(double num1,double num2){
        return num1*num2;
    }
    public static double div(double num1,double num2){
        return num1/num2;
    }
}
